/*
 * Copyright (c) 2011. This file is public under GPLv3 license.
 * For more information about license please refer to http://www.gnu.org/licenses/gpl.html
 */

package com.freetools.watchdog.utils;

import java.util.List;

/**
 * Description to be do.
 *
 * @author
 */
public final class DoggyUtils
{
    public static <E> E getLast(List<E> list)
    {
        return list.size() > 0 ? list.get(list.size() - 1) : null;
    }

    public static <E> E setLast(List<E> list, E obj)
    {
        if (list.size() > 0)
            list.set(list.size() - 1, obj);
        else
            list.add(obj);
        return obj;
    }
}
